package com.koron.system.common.util;

import com.koron.common.core.business.configsettings.utils.ConfigInfoTool;

import java.util.Map;

/**
 * @ClassName UnifyPlatApi
 * @description
 * @Author zhouj
 * @Date 2021/7/8 14:11
 */
public class UnifyPlatApi {

    private String url;

    //获取组织接口
    //private String PORT_ORGCODE = "/port/orgNode.htm";
    //获取用户接口
    //private String PORT_STAFF = "/port/staff.htm";

    public UnifyPlatApi() {
        url = getUnifyPlatUrl();
    }

    public String getUrl() {
        return getUnifyPlatUrl();
    }

    public String getPORT_ORGCODE() {
        return getUrl() + getUnifyPlatApi("org");
    }

    public String getPORT_STAFF() {
        return getUrl() + getUnifyPlatApi("staff");
    }

    public String getUnifyPlatUrl() {
        Map<String, String> map = ConfigInfoTool.getConfigByCode("system", "org");
        String environment = map.get("environment");

        return map.get(environment + "_" + "unifyUrl");
    }

    public String getUnifyPlatApi(String key) {
        Map<String, String> cond = ConfigInfoTool.getConfigByCode("system", "org");
        String environment = cond.get("environment");

        Map<String, String> map = ConfigInfoTool.getConfigByCode("system", "unifyPlatApi");
        return map.get(environment + "_" + key);
    }

}
